/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.Bitacora.vista;

import javax.enterprise.context.spi.Context;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Raven
 */
@ManagedBean
@SessionScoped
public class AccessBean {
    //--------variables(propiedades)
private String name;
private String password;
   //---------constructores
    public AccessBean() {
    }
//----------metodos get y set
    public String getName() {
        System.out.println("entro al get");
        return name;
    }

    public void setName(String name) {
        System.out.println("entro al set");
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
  //-----------acciones---------------
    public String validarLogin(){
    if(name.equals("EDDS")&password.equals("1234")){
        FacesContext context=FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap().put("USUARIO_LOGUEADO",name);
    return "PaginaPrincipal";
    }else{
    return "BadLogin";
    }
    }
    
  //-----------listeners
}
